<?php
/**
 * Created by PhpStorm.
 * User: zhangligang
 * Date: 17/4/27
 * Time: 下午10:55
 */

namespace App\Http\Presenter;


use App\Http\Models\Comment;
use Illuminate\Database\Eloquent\Collection;

class CommentPresenter implements Presenter
{

    /**
     *
     */
    public function __construct() {
        //
    }

    /**
     * @param Collection $commentList
     * @return array
     */
    public function formatProductList(Collection $commentList)
    {

        $result = [];

        foreach ($commentList as $comment) {

            $result[] = $this->formatProduct($comment);
        }

        return $result;
    }

    /**
     * @param Comment $comment
     * @return array
     */
    public function formatProduct(Comment $comment)
    {

        if (!$comment) return [];



        return [
            'id' => (int)$comment->id,
        ];
    }

}